define(["jquery","bbcare"],function($,$bb){
	var servers = {};
	var URL = $bb.baseUrl("followup");

	/**
	 * 请求营养方案列表
	 */
	servers.ajaxSchemeList = function(callback){
		$bb.ajax({
            url: URL + "followup/service/nutrition/scheme/querylist",
            success: function(data){
                if(data.success){
                    callback(data.rows);
                }else{
                    $bb.toastShow(data.msg ? data.msg : "请求营养方案列表出错！");
                }
            }
        });
	}

	/**
	 * 请求患者列表
	 */
	servers.ajaxPatients = function(params,callback){
		$bb.ajax({
            url: URL + "followup/service/patient/patientQueueListQuery",
            data: JSON.stringify({
                data: params
            }),
            success: function(data){
                if(data.success){
                    callback(data.data);
                }else{
                    $bb.toastShow(data.msg ? data.msg : "请求患者列表出错！");
                }
            }
        });
	}

	/**
	 * 启用营养方案
	 */
	servers.ajaxSchemeUsed = function(params,callback){
		$bb.ajax({
            url: URL + "followup/service/nutrition/patientscheme/used",
            data: JSON.stringify({
                data: params
            }),
            success: function(data){
                if(data.success){
                    callback(data.data,params.userId);
                }else{
                    $bb.toastShow(data.msg ? data.msg : "启用营养方案出错！");
                }
            }
        });
	}

	return servers;
});